package com.dbpms.pj.sys.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: Song Yu
 * @Date: 2020/10/19 14:08
 */
@Mapper
public interface SysRoleMenuDao {

    /**基于菜单id执行关系数据的删除*/
    @Delete("delete from sys_role_menus where menu_id=#{menuId}")
    int deleteObjectsByMenuId(Integer menuId);

    @Select("select menu_id from sys_role_menus where role_id=#{roleId}")
    List<Integer> findMenuIdsByRoleId(Integer roleId);

    int insertObjects(Integer roleId,Integer[] menuIds);

    @Delete("delete from sys_role_menus where role_id=#{roleId}")
    int deleteObjectsByRoleId(Integer roleId);

    List<Integer> findMenuIdsByRoleIds(Integer[] roleIds);
}
